From: Eric S. Raymond Date: Sat, 27 Mar 1993 01:58:38 +0000 (+0000) Subject: (printify-buffer) Added, debugged from Roland McGrath's printify-buffer code X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96678 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=1c2df06340453138e48857c93e6eee1842833c14;p=emacs.git (printify-buffer) Added, debugged from Roland McGrath's printify-buffer code in LCD. --- diff --git a/lisp/lpr.el b/lisp/lpr.el index 2beead551ec..3bd12335068 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -108,4 +108,20 @@ See definition of `print-region-1' for calling conventions.") (insert-buffer-substring oldbuf start end) (setq start (point-min) end (point-max))))) +(defun printify-region (begin end) + "Turn nonprinting characters (other than TAB, LF, SPC, RET, and FF) +in the current buffer into printable representations as control or +hexadecimal escapes." + (interactive "r") + (save-excursion + (goto-char begin) + (let (c) + (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" end t) + (setq c (preceding-char)) + (delete-backward-char 1) + (insert + (if (< c ?\ ) + (format "\\^%c" (+ c ?@)) + (format "\\%02x" c))))))) + ;;; lpr.el ends here